// characteristic length
lc=0.1;

//points at the ends of a rectangular domain
Point(1) = {0, 0, 0, lc};
Point(2) = {1, 0, 0, lc};
Point(3) = {0, 1, 0, lc};
Point(4) = {1, 1, 0, lc};

//create lines
Line(1) = {3, 4};
Line(2) = {4, 2};
Line(3) = {2, 1};
Line(4) = {1, 3};

//create line loop for domain
Line Loop(6) = {1, 2, 3, 4};

//create surface for domain
Plane Surface(6) = {6};

//create physical boundary at pn junction
Physical Line(7) = {4};

//create physical domain 
Physical Surface(8) = {6};

//create physical boundary at top surface
Physical Line(9) = {3};